﻿<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8" />
	<title></title>
</head>

<body>
	<form action="saveGoodsType.php" method="post" onsubmit="return myPreDo()">
		商品编号：<input id="typeId" type="text" name="typeId" /><br />
		商品类型：<input id="typeName" type="text" name="goodsType" /><br />
		<input type="submit" value="保存" />
	</form>
</body>

</html>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="./js/tools.js"></script>
<script>

	function myPreDo() {
		let objs = { "typeId": "商品编号", "typeName": "商品类型" }
		return preDo(objs);
	}

	$(function () {
		$.get('getMaxTypeId.php', function (data) {
			let maxTypeId = "001";
			if (data != "") {
				let str = "00" + (parseInt(data) + 1);
				maxTypeId = str.substr(str.length - 3, 3);
			}
			if (isNaN(maxTypeId)) {
				maxTypeId = "001";
			}
			$("#typeId").val(maxTypeId);
		});

	});



</script>